home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 October / macformat-029.iso / mac / Shareware City / Developers / Selection ƒ 2.5 / tebox < prev    next >
Encoding:
Text File  |  1994-11-06  |  1.1 KB  |  66 lines  |  [TEXT/MSET]

  1.  \ 25Dec93 DBH made font the superclass
  2.  \ 28Oct94 dbh updated to 2.5 syntax 
  3.  
  4. (*
  5.  
  6. A tebox is te with a black border.  Note that the actual dimensions of
  7. the tebox are determined by the font, maximum number of characters to
  8. display on one line, and the maximum number of lines to display.
  9.  
  10. *)
  11.  
  12.  
  13. :class tebox super{ te }
  14.     graphicRect outline
  15.     int #chars    \ maximum # of chars we will display on one line
  16.     int #lines    \ maximum # of lines we will display
  17.  
  18. :m move:    { dx dy -- }
  19.     dx dy move: super
  20.     dx dy move: outline ;m
  21.     
  22. :m moveto:    { x y -- }
  23.     x y moveto: super
  24.     x y moveto: outline ;m
  25.  
  26. :m init:  ( #chars #lines -- )
  27.     put: #lines 
  28.     put: #chars ;m
  29.  
  30. :m classinit:
  31.     10 1 init: self
  32.     50 50 moveto: self
  33.     ;m
  34.  
  35. :m new:  ( wptr -- )
  36.     new: super
  37.     lineheight: super \ font
  38.     get: #lines *  setheight: outline
  39.     widmax: super \ font
  40.     get: #chars 1+ *  setwidth: outline
  41.     get: outline setdest: super
  42.     get: outline setview: super
  43.     -1 -1 inset: outline
  44.     ;m
  45.  
  46. :m draw:
  47.     draw: super
  48.     draw: outline ;m
  49.  
  50. ;class
  51.  
  52. endload
  53.  
  54. *** EXAMPLE USE
  55.  
  56. selwindow w
  57. test: w
  58.  
  59. tebox tb
  60. tb add: w
  61.  
  62. tebox tb2
  63. 0 40 move: tb2
  64. tb2 add: w
  65.  
  66.